package com.easylinkin.linkappapi.grid.models.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import site.morn.validate.group.Update;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.List;

/**
 * 网格信息表
 *
 * @author 
 * @since 2024-05-15
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class GridInfoDTO implements Serializable{
    private static final long serialVersionUID=1L;

    @NotNull(message = "网格ID不能为空", groups = { Update.class })
    @ApiModelProperty(value = "网格ID", name = "id")
    private Integer id;
    /**
     * 上级ID(作用于三级网格)
     */
    @ApiModelProperty(value = "上级ID(作用于三级网格)", name = "parentId")
    private Integer parentId;
    /**
     * 网格名称
     */
    @NotBlank(message = "网格名称不能为空")
    @Size(max = 20, message = "网格名称最大不能超过{max}")
    @ApiModelProperty(value = "网格名称", name = "gridName")
    private String gridName;

    /**
     * 网格层级
     */
    @Min(value = 2,message = "最小只允许添加二级网格")
    @Max(value = 3,message = "最大只允许添加三级网格")
    @NotNull(message = "网格层级不能为空")
    @ApiModelProperty(value = "网格层级", name = "gridLevel")
    private Integer gridLevel;

    @Valid
    @NotEmpty(message = "网格角色不能为空")
    @ApiModelProperty(value = "网格角色集合", name = "roleList")
    private List<GridRoleDTO> roleList;

}
